<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  
  <div id="components-demo">
    <button-counter></button-counter>
    <button-counter2></button-counter2>
  </div>

  <div id="components-demo2">
  </div>
  
  <script src="./js/vue.js"></script>
  <script>

    const ButtonCounter2 = Vue.extend({
      data: function () {
        return {
          count: 0
        }
      },

      template: '<button v-on:click="count++">你点击了 {{ count }} 次。</button>'
    })
    const Test = Vue.component('ButtonCounter2', ButtonCounter2)
    console.log(Test===ButtonCounter2)

    // 定义一个新的组件，名称为 button-counter
    Vue.component('buttonCounter', {
      data: function () {
        return {
          count: 0
        }
      },

      template: '<button v-on:click="count++">你点击了 {{ count }} 次。</button>'
    })

    new Vue({ el: '#components-demo' })
    const com = new ButtonCounter2()
    com.$mount('#components-demo2')
    console.log(com)
  </script>
</body>
</html>